package com.gudaomai.ekproject.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.gudaomai.ekproject.entity.Project;
import com.gudaomai.ekproject.mapper.ProjectMapper;
import com.gudaomai.ekproject.service.IProjectService;
import com.gudaomai.ekproject.service.impl.BaseServiceImpl;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目 服务实现类
 * </p>
 *
 * @author zenghualu
 * @since 2017-06-26
 */
@Service
public class ProjectServiceImpl extends BaseServiceImpl<ProjectMapper, Project> implements IProjectService {

	/**
	 * 判断工程名是否已经存在
	 */
	public boolean isExist(String projectName) {
		// 检测工程名是否存在[此操作前存在注解校验是否为空等,所以代码不必校验pro.getName是否为空]
		
		EntityWrapper<Project> ew=new EntityWrapper<>();
		ew.setEntity(new Project());
		ew.eq("name", projectName);
		
		Project project=this.selectOne(ew);
		if (project == null) {
			return false;
		}
		return true;
	}
}
